<?php 
#echo $_SERVER["REQUEST_URI"];exit();
#print_r($HttpResult);
if(1==2){$HttpResult = new HttpResult();}
if(!isset($title)){
	//caso de include dessa página e queira reescrever o titulo, sete a variavel
	$title = "Novo Pagamento";
}
$HttpContentResult = $HttpResult->getHttpContentResult();
//Debug::print_r($HttpResult);
//$lang = Config::DEFAULT_LOCALE;
$head = new HtmlHeader($HttpContentResult->getHeader());
$head->addCSS('reset');
$head->addCSS('print','', 'print');
$head->addCSS('ie',  'css/ie', 'print',true);

$head->addCSS('forum',"css/admin");		

//<!-- PROGRAMACAO JS | JQUERY  -->
$head->addJS(array('jquery', 'masked'));

//MENU DROPDOWN
$head->addJS('Menu principal','js/menu/ddsmoothmenu');
$head->addCSS('Menu CSS','js/menu/ddsmoothmenu');

//TINYMCE
$head->addJS('tinymce','js/tinymce/jquery.tinymce');

//FILEUPLOAD
$head->addJS('so','js/uploadify/swfobject');
$head->addJS('uploadify','js/uploadify/jquery.uploadify.v2.1.4.min');
$head->addCSS('Upload CSS','js/uploadify/uploadify');
   
//SLIDER SHOW
$head->addJS('cycle', 'js/cycle/jquery.cycle.min');

//<!-- JQUERY UI  -->
$head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
$head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');
	
 //SELECTMENU
$head->addJS('selectmenu','js/UI/development-bundle/ui/jquery.ui.selectmenu');
$head->addCSS('selectmenu CSS','js/UI/css/jquery.ui.selectmenu');

//<!-- VTIP  -->
$head->addJS('vtip', 'js/vtip/vtip');
$head->addCSS('vtip', 'js/vtip/vtip');

//<!-- TABLE SORTER -->
$head->addJS('tablesorter', 'js/tablesorter/tablesorter');
$head->addCSS('tablesorter', 'js/tablesorter/tablesorter');

//<!-- PROGRAMACAO JS | JQUERY  -->
$head->addJS(array('admin/money_history/crud'));

$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;
?>
 
<body>
	<div id="main">
		<?php include "view/democrart/parts/admin/header.php" ?>	      
		<div id="main_content">
			<div id="box_right">
				<h1><?php echo $title; ?></h1>
				<a style="float: right;margin: 10px 5px;" href="<?php echo Config::getRootPath("admin/money_history/type.3"); ?>" class="button"><?php echo Translation::text("Lista de Pagamentos"); ?></a>
				<div id="msgBox"></div>
				<div style="clear:both">
                    <form method="post" class="filter" onsubmit="return MoneyHistoryCrud.insert();"
                         enctype="multipart/form-data" action="<?php echo Config::getRootPath("admin/money_history/send_money/id.".$HttpContentResult->partner->getId()."/insert.1/"); ?>">
                    
						<label for="username" style="width:100px;display:block;float:left;">Parceiro:</label>
						<span id=username><?php echo $HttpContentResult->partner->name; ?></span>
						<br /><br />

						<input type="hidden" id="money_history_id" name="money_history_id" value="<?php echo $HttpContentResult->vo->getId(); ?>" />
						
						<label for="title" style="width:100px;display:block;float:left;">T&iacute;tulo:</label>
						<input type="text" id="title" name="title" value="<?php echo $HttpContentResult->vo->getTitle(); ?>" />
						<br /><br />
						<label for="amount" style="width:100px;display:block;float:left;">Valor:</label>
						<input type="text" id="value" name="value" value="<?php echo $HttpContentResult->vo->value*-1; ?>" />
						
						<br />
						
						<?php
						//abaixo, o mais correto é fazer na controller, mas não está errado fazer na view
						include_once("library/facil3/core/modules/file/FileFormView.class.php");
						$formView = new FileFormView();
						//configurando o limite para esse plugin
						$formView->setQuantity(1);//significa que só pode 1 arquivo
						$formView->setDescription(array('label'	=>Translation::text('Descrição'),
			'visible'		=>	true));
						//normalmente isso é feito na controller, MAS...
						$arrayFiles = $HttpContentResult->vo->getFiles();
						// Debug::print_r($arrayFiles);
						// exit();
						$formView->setArrayFiles($arrayFiles);
						include "view/plugins/file.php";
						?>
						
						<br />
						<input type="submit" id="save" name="save" value="Salvar" class="button" style="margin-left:100px;" />
					</form>
				</div>
			</div>
		</div>	
	</div>
</body>
</html>